// ....................................................................................................................
//	Author: Copyright (C) 2012 Ing. Marek Hubal
//	Email: hubal@acasoftware.org
// ....................................................................................................................

#pragma once

#include <Shobjidl.h>

// ....................................................................................................................
// Trieda IShellContextMenu
// ....................................................................................................................
class IShellContextMenu {
protected:
    IContextMenu *FContextMenu;
    IContextMenu2 *FContextMenu2;
    IContextMenu3 *FContextMenu3;
    IShellFolder *FDesktopFolder;
    IShellFolder *FParentFolder;
	LPITEMIDLIST *FPidls;
	INT32 FPidlCount;
	IString FParentFolderString;
	POINT FContentMenuStartPoint;
protected:
	IShellFolder* __fastcall GetDesktopFolder(void); // Ziskanie desktop priecinku
	IShellFolder* __fastcall GetParentFolder(CONST_PCHAR pValue); // Ziskanie rodicovkeho priecinku
	void __fastcall FreePidls(LPITEMIDLIST *pList, INT32 pCount); // Uvolnenie zoznam pidl
	LPITEMIDLIST* __fastcall CreatePidls(IStringList *pNames); // Vytvorenie zoznamu pidl
	bool __fastcall GetContextMenuInterfaces(IShellFolder *pParentFolder, LPITEMIDLIST *pList, INT32 pCount); // Ziskanie interface na shell menu
	void __fastcall InvokeCommand(HWND pHandle, IContextMenu *pMenu, UINT32 pCmdID, CONST_PCHAR pFolderName, bool pCtrl = false, bool pShift = false, INT32 pX = -1, INT32 pY = -1); // Spustenie prikazu
	void __fastcall InvokeCommand(HWND pHandle, IContextMenu *pMenu, CONST_PCHAR pCmdID, CONST_PCHAR pFolderName, bool pCtrl = false, bool pShift = false, INT32 pX = -1, INT32 pY = -1); // Spustenie prikazu
	INT32 __fastcall FindFunctionCommandID(HMENU M, PCHAR pVerb);
public:
	IShellContextMenu(void); // Konstruktor
	~IShellContextMenu(void); // Destruktor
public:
	void __fastcall ReleaseAll(void); // Uvolnenie vsetkych objektov
	void __fastcall ShowContextMenu(HWND pParent, IStringList *pNames, INT32 pX = -1, INT32 pY = -1); // Zobrazenie context menu
	void __fastcall CallHookProcedure(CWPSTRUCT *pParam); // Volana funkcia z hook procedury
	void __fastcall ExecuteShellCommand(HWND pParent, IStringList *pNames, CONST_PCHAR pOperation); // Vykonanie prikazu dostupneho zo shell menu
	void __fastcall ExecuteShellCommand(HWND pParent, IStringList *pNames, INT32 pOperation); // Vykonanie prikazu dostupneho zo shell menu
public:
	static void __fastcall ShowMapNetworkDriveWindow(HWND pParent); // Zobrazenie okna pre mapovanie sietoveho disku
	static IShellFolder2* __fastcall GetFolderObject(CONST_PCHAR pPath); // Ziskanie objektu IShellFolder pre zadanu cestu
	static PIDLIST_ABSOLUTE __fastcall CreateITEMIDLISTFromPath(CONST_PCHAR pPath); // Ziskanie ITEMIDLIST z absolutnej cesty
	static void __fastcall FreeITEMIDLIST(PIDLIST_ABSOLUTE pValue); // Uvolnenie ITEMIDLIST struktury
};
// ....................................................................................................................
